import { IPSAppDEAction } from '../../app/dataentity/ipsapp-deaction';
import { IPSAppDEDataSet } from '../../app/dataentity/ipsapp-dedata-set';
import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSControlXDataContainer } from '../ipscontrol-xdata-container';
import { PSControlItemImpl2 } from '../pscontrol-item-impl2';
import { IPSSysMapItem } from './ipssys-map-item';
import { IPSDEContextMenu } from '../toolbar/ipsdecontext-menu';
import { IPSDEOPPriv } from '../../dataentity/priv/ipsdeoppriv';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysCss } from '../../res/ipssys-css';
import { IPSSysImage } from '../../res/ipssys-image';

export class PSSysMapItemImpl extends PSControlItemImpl2 implements IPSSysMapItem, IPSControlXDataContainer {
  protected altitudepsappdefield: IPSAppDEField | null = null;

  getAltitudePSAppDEField(): IPSAppDEField | null {
    if (this.altitudepsappdefield != null) return this.altitudepsappdefield;
    const value = this.M.getAltitudePSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.altitudepsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.altitudepsappdefield;
  }

  get altitudePSAppDEField(): IPSAppDEField | null {
    return this.getAltitudePSAppDEField();
  }

  getAltitudePSAppDEFieldMust(): IPSAppDEField {
    const value = this.getAltitudePSAppDEField();
    if (value == null) {
      throw new Error('未指定高度值应用实体属性');
    }
    return value;
  }

  get bKColor(): string {
    return this.M.bKColor;
  }

  protected bkcolorpsappdefield: IPSAppDEField | null = null;

  getBKColorPSAppDEField(): IPSAppDEField | null {
    if (this.bkcolorpsappdefield != null) return this.bkcolorpsappdefield;
    const value = this.M.getBKColorPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.bkcolorpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.bkcolorpsappdefield;
  }

  get bKColorPSAppDEField(): IPSAppDEField | null {
    return this.getBKColorPSAppDEField();
  }

  getBKColorPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getBKColorPSAppDEField();
    if (value == null) {
      throw new Error('未指定背景颜色应用实体属性');
    }
    return value;
  }

  get borderColor(): string {
    return this.M.borderColor;
  }

  get borderWidth(): number {
    return this.M.borderWidth;
  }

  protected clspsappdefield: IPSAppDEField | null = null;

  getClsPSAppDEField(): IPSAppDEField | null {
    if (this.clspsappdefield != null) return this.clspsappdefield;
    const value = this.M.getClsPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.clspsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.clspsappdefield;
  }

  get clsPSAppDEField(): IPSAppDEField | null {
    return this.getClsPSAppDEField();
  }

  getClsPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getClsPSAppDEField();
    if (value == null) {
      throw new Error('未指定项样式表值应用实体属性');
    }
    return value;
  }

  get color(): string {
    return this.M.color;
  }

  protected colorpsappdefield: IPSAppDEField | null = null;

  getColorPSAppDEField(): IPSAppDEField | null {
    if (this.colorpsappdefield != null) return this.colorpsappdefield;
    const value = this.M.getColorPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.colorpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.colorpsappdefield;
  }

  get colorPSAppDEField(): IPSAppDEField | null {
    return this.getColorPSAppDEField();
  }

  getColorPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getColorPSAppDEField();
    if (value == null) {
      throw new Error('未指定文本颜色应用实体属性');
    }
    return value;
  }

  protected contentpsappdefield: IPSAppDEField | null = null;

  getContentPSAppDEField(): IPSAppDEField | null {
    if (this.contentpsappdefield != null) return this.contentpsappdefield;
    const value = this.M.getContentPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.contentpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.contentpsappdefield;
  }

  get contentPSAppDEField(): IPSAppDEField | null {
    return this.getContentPSAppDEField();
  }

  getContentPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getContentPSAppDEField();
    if (value == null) {
      throw new Error('未指定内容应用实体属性');
    }
    return value;
  }

  protected grouppsappdefield: IPSAppDEField | null = null;

  getGroupPSAppDEField(): IPSAppDEField | null {
    if (this.grouppsappdefield != null) return this.grouppsappdefield;
    const value = this.M.getGroupPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.grouppsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.grouppsappdefield;
  }

  get groupPSAppDEField(): IPSAppDEField | null {
    return this.getGroupPSAppDEField();
  }

  getGroupPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getGroupPSAppDEField();
    if (value == null) {
      throw new Error('未指定分组值应用实体属性');
    }
    return value;
  }

  protected iconpsappdefield: IPSAppDEField | null = null;

  getIconPSAppDEField(): IPSAppDEField | null {
    if (this.iconpsappdefield != null) return this.iconpsappdefield;
    const value = this.M.getIconPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.iconpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.iconpsappdefield;
  }

  get iconPSAppDEField(): IPSAppDEField | null {
    return this.getIconPSAppDEField();
  }

  getIconPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getIconPSAppDEField();
    if (value == null) {
      throw new Error('未指定项图标值应用实体属性');
    }
    return value;
  }

  protected idpsappdefield: IPSAppDEField | null = null;

  getIdPSAppDEField(): IPSAppDEField | null {
    if (this.idpsappdefield != null) return this.idpsappdefield;
    const value = this.M.getIdPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.idpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.idpsappdefield;
  }

  get idPSAppDEField(): IPSAppDEField | null {
    return this.getIdPSAppDEField();
  }

  getIdPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getIdPSAppDEField();
    if (value == null) {
      throw new Error('未指定项标识值应用实体属性');
    }
    return value;
  }

  get itemStyle(): 'POINT' | 'POINT2' | 'POINT3' | 'POINT4' | 'LINE' | 'LINE2' | 'LINE3' | 'LINE4' | 'REGION' | 'REGION2' | 'REGION3' | 'REGION4' | 'USER' | 'USER2' | 'USER3' | 'USER4' {
    return this.M.itemStyle;
  }

  get itemType(): string {
    return this.M.itemType;
  }

  protected latitudepsappdefield: IPSAppDEField | null = null;

  getLatitudePSAppDEField(): IPSAppDEField | null {
    if (this.latitudepsappdefield != null) return this.latitudepsappdefield;
    const value = this.M.getLatitudePSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.latitudepsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.latitudepsappdefield;
  }

  get latitudePSAppDEField(): IPSAppDEField | null {
    return this.getLatitudePSAppDEField();
  }

  getLatitudePSAppDEFieldMust(): IPSAppDEField {
    const value = this.getLatitudePSAppDEField();
    if (value == null) {
      throw new Error('未指定维度值应用实体属性');
    }
    return value;
  }

  protected longitudepsappdefield: IPSAppDEField | null = null;

  getLongitudePSAppDEField(): IPSAppDEField | null {
    if (this.longitudepsappdefield != null) return this.longitudepsappdefield;
    const value = this.M.getLongitudePSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.longitudepsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.longitudepsappdefield;
  }

  get longitudePSAppDEField(): IPSAppDEField | null {
    return this.getLongitudePSAppDEField();
  }

  getLongitudePSAppDEFieldMust(): IPSAppDEField {
    const value = this.getLongitudePSAppDEField();
    if (value == null) {
      throw new Error('未指定经度值应用实体属性');
    }
    return value;
  }

  get maxSize(): number {
    return this.M.maxSize;
  }

  get modelObj(): string {
    return this.M.modelObj;
  }

  protected namepslanguageres: IPSLanguageRes | null = null;

  getNamePSLanguageRes(): IPSLanguageRes | null {
    if (this.namepslanguageres != null) return this.namepslanguageres;
    const value = this.M.getNamePSLanguageRes;
    if (value == null) {
      return null;
    }
    this.namepslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getNamePSLanguageRes') as IPSLanguageRes;
    return this.namepslanguageres;
  }

  get namePSLanguageRes(): IPSLanguageRes | null {
    return this.getNamePSLanguageRes();
  }

  getNamePSLanguageResMust(): IPSLanguageRes {
    const value = this.getNamePSLanguageRes();
    if (value == null) {
      throw new Error('未指定名称语言资源');
    }
    return value;
  }

  get orderValue(): number {
    return this.M.orderValue != null ? this.M.orderValue : 99999;
  }

  protected ordervaluepsappdefield: IPSAppDEField | null = null;

  getOrderValuePSAppDEField(): IPSAppDEField | null {
    if (this.ordervaluepsappdefield != null) return this.ordervaluepsappdefield;
    const value = this.M.getOrderValuePSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.ordervaluepsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.ordervaluepsappdefield;
  }

  get orderValuePSAppDEField(): IPSAppDEField | null {
    return this.getOrderValuePSAppDEField();
  }

  getOrderValuePSAppDEFieldMust(): IPSAppDEField {
    const value = this.getOrderValuePSAppDEField();
    if (value == null) {
      throw new Error('未指定排序值应用实体属性');
    }
    return value;
  }

  protected psappdedataset: IPSAppDEDataSet | null = null;

  getPSAppDEDataSet(): IPSAppDEDataSet | null {
    if (this.psappdedataset != null) return this.psappdedataset;
    const value = this.M.getPSAppDEDataSet;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdedataset = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset;
  }

  get psAppDEDataSet(): IPSAppDEDataSet | null {
    return this.getPSAppDEDataSet();
  }

  getPSAppDEDataSetMust(): IPSAppDEDataSet {
    const value = this.getPSAppDEDataSet();
    if (value == null) {
      throw new Error('未指定应用实体数据集');
    }
    return value;
  }

  protected psappdataentity: IPSAppDataEntity | null = null;

  getPSAppDataEntity(): IPSAppDataEntity | null {
    if (this.psappdataentity != null) return this.psappdataentity;
    const value = this.M.getPSAppDataEntity;
    if (value == null) {
      return null;
    }
    this.psappdataentity = this.getPSModel4('app.dataentity.IPSAppDataEntity', value, 'getPSAppDataEntity') as IPSAppDataEntity;
    return this.psappdataentity;
  }

  get psAppDataEntity(): IPSAppDataEntity | null {
    return this.getPSAppDataEntity();
  }

  getPSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getPSAppDataEntity();
    if (value == null) {
      throw new Error('未指定应用实体对象');
    }
    return value;
  }

  protected psdecontextmenu: IPSDEContextMenu | null = null;

  getPSDEContextMenu(): IPSDEContextMenu | null {
    if (this.psdecontextmenu != null) return this.psdecontextmenu;
    const value = this.M.getPSDEContextMenu;
    if (value == null) {
      return null;
    }
    this.psdecontextmenu = this.getPSModel4('control.toolbar.IPSDEContextMenu', value, 'getPSDEContextMenu') as IPSDEContextMenu;
    return this.psdecontextmenu;
  }

  get psDEContextMenu(): IPSDEContextMenu | null {
    return this.getPSDEContextMenu();
  }

  getPSDEContextMenuMust(): IPSDEContextMenu {
    const value = this.getPSDEContextMenu();
    if (value == null) {
      throw new Error('未指定上下文菜单对象');
    }
    return value;
  }

  protected pssyscss: IPSSysCss | null = null;

  getPSSysCss(): IPSSysCss | null {
    if (this.pssyscss != null) return this.pssyscss;
    const value = this.M.getPSSysCss;
    if (value == null) {
      return null;
    }
    this.pssyscss = this.getPSModel4('res.IPSSysCss', value, 'getPSSysCss') as IPSSysCss;
    return this.pssyscss;
  }

  get psSysCss(): IPSSysCss | null {
    return this.getPSSysCss();
  }

  getPSSysCssMust(): IPSSysCss {
    const value = this.getPSSysCss();
    if (value == null) {
      throw new Error('未指定项界面样式表');
    }
    return value;
  }

  protected pssysimage: IPSSysImage | null = null;

  getPSSysImage(): IPSSysImage | null {
    if (this.pssysimage != null) return this.pssysimage;
    const value = this.M.getPSSysImage;
    if (value == null) {
      return null;
    }
    this.pssysimage = this.getPSModel4('res.IPSSysImage', value, 'getPSSysImage') as IPSSysImage;
    return this.pssysimage;
  }

  get psSysImage(): IPSSysImage | null {
    return this.getPSSysImage();
  }

  getPSSysImageMust(): IPSSysImage {
    const value = this.getPSSysImage();
    if (value == null) {
      throw new Error('未指定项图标对象');
    }
    return value;
  }

  get radius(): number {
    return this.M.radius;
  }

  protected removepsappdeaction: IPSAppDEAction | null = null;

  getRemovePSAppDEAction(): IPSAppDEAction | null {
    if (this.removepsappdeaction != null) return this.removepsappdeaction;
    const value = this.M.getRemovePSAppDEAction;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.removepsappdeaction = ipsappdataentity.findPSAppDEAction(value);
    }
    return this.removepsappdeaction;
  }

  get removePSAppDEAction(): IPSAppDEAction | null {
    return this.getRemovePSAppDEAction();
  }

  getRemovePSAppDEActionMust(): IPSAppDEAction {
    const value = this.getRemovePSAppDEAction();
    if (value == null) {
      throw new Error('未指定删除数据应用实体行为');
    }
    return value;
  }

  protected removepsdeoppriv: IPSDEOPPriv | null = null;

  getRemovePSDEOPPriv(): IPSDEOPPriv | null {
    if (this.removepsdeoppriv != null) return this.removepsdeoppriv;
    const value = this.M.getRemovePSDEOPPriv;
    if (value == null) {
      return null;
    }
    this.removepsdeoppriv = this.getPSModel4('dataentity.priv.IPSDEOPPriv', value, 'getRemovePSDEOPPriv') as IPSDEOPPriv;
    return this.removepsdeoppriv;
  }

  get removePSDEOPPriv(): IPSDEOPPriv | null {
    return this.getRemovePSDEOPPriv();
  }

  getRemovePSDEOPPrivMust(): IPSDEOPPriv {
    const value = this.getRemovePSDEOPPriv();
    if (value == null) {
      throw new Error('未指定删除要求操作标识');
    }
    return value;
  }

  protected tag2psappdefield: IPSAppDEField | null = null;

  getTag2PSAppDEField(): IPSAppDEField | null {
    if (this.tag2psappdefield != null) return this.tag2psappdefield;
    const value = this.M.getTag2PSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.tag2psappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.tag2psappdefield;
  }

  get tag2PSAppDEField(): IPSAppDEField | null {
    return this.getTag2PSAppDEField();
  }

  getTag2PSAppDEFieldMust(): IPSAppDEField {
    const value = this.getTag2PSAppDEField();
    if (value == null) {
      throw new Error('未指定标记值2应用实体属性');
    }
    return value;
  }

  protected tagpsappdefield: IPSAppDEField | null = null;

  getTagPSAppDEField(): IPSAppDEField | null {
    if (this.tagpsappdefield != null) return this.tagpsappdefield;
    const value = this.M.getTagPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.tagpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.tagpsappdefield;
  }

  get tagPSAppDEField(): IPSAppDEField | null {
    return this.getTagPSAppDEField();
  }

  getTagPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getTagPSAppDEField();
    if (value == null) {
      throw new Error('未指定标记值应用实体属性');
    }
    return value;
  }

  protected textpsappdefield: IPSAppDEField | null = null;

  getTextPSAppDEField(): IPSAppDEField | null {
    if (this.textpsappdefield != null) return this.textpsappdefield;
    const value = this.M.getTextPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.textpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.textpsappdefield;
  }

  get textPSAppDEField(): IPSAppDEField | null {
    return this.getTextPSAppDEField();
  }

  getTextPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getTextPSAppDEField();
    if (value == null) {
      throw new Error('未指定项文本值应用实体属性');
    }
    return value;
  }

  protected tipspsappdefield: IPSAppDEField | null = null;

  getTipsPSAppDEField(): IPSAppDEField | null {
    if (this.tipspsappdefield != null) return this.tipspsappdefield;
    const value = this.M.getTipsPSAppDEField;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.tipspsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.tipspsappdefield;
  }

  get tipsPSAppDEField(): IPSAppDEField | null {
    return this.getTipsPSAppDEField();
  }

  getTipsPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getTipsPSAppDEField();
    if (value == null) {
      throw new Error('未指定提示应用实体属性');
    }
    return value;
  }

  get enableEditData(): boolean {
    return this.M.enableEditData;
  }

  get enableExport(): boolean {
    return this.M.enableExport != null ? this.M.enableExport : false;
  }

  get enableFilter(): boolean {
    return this.M.enableFilter;
  }

  get enableImport(): boolean {
    return this.M.enableImport != null ? this.M.enableImport : false;
  }

  get enableNewData(): boolean {
    return this.M.enableNewData;
  }

  get enableQuickCreate(): boolean {
    return this.M.enableQuickCreate;
  }

  get enableQuickSearch(): boolean {
    return this.M.enableQuickSearch != null ? this.M.enableQuickSearch : false;
  }

  get enableRemoveData(): boolean {
    return this.M.enableRemoveData;
  }

  get enableSearch(): boolean {
    return this.M.enableSearch != null ? this.M.enableSearch : false;
  }

  get enableViewData(): boolean {
    return this.M.enableViewData;
  }

  get loadDefault(): boolean {
    return this.M.loadDefault != null ? this.M.loadDefault : true;
  }

  get pickupMode(): boolean {
    return this.M.pickupMode != null ? this.M.pickupMode : false;
  }

  get readOnly(): boolean {
    return this.M.readOnly != null ? this.M.readOnly : false;
  }

  get cls(): string {
    return 'PSSysMapItemImpl';
  }

  instanceof(cls: string): boolean {
    if (
      cls == 'IPSModelObject' ||
      cls == 'IPSModelSortable' ||
      cls == 'IPSObject' ||
      cls == 'control.IPSControlMDObject' ||
      cls == 'control.IPSControlMDataContainer' ||
      cls == 'control.IPSControlXDataContainer' ||
      cls == 'control.map.IPSMapItem' ||
      cls == 'control.map.IPSSysMapItem'
    )
      return true;
    return super.instanceof(cls);
  }
}
